<?xml version="1.0" encoding="UTF-8"?>
<ui:composition template="/WEB-INF/templates/default.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:p="http://primefaces.org/ui"
	xmlns:my="http://java.sun.com/jsf/composite/components">
	<ui:define name="content">

		<h:form id="osobaForm">

			<rich:panel styleClass="formPanel">
				<f:facet name="header"> Rejestracja użytkownika </f:facet>
				<p:messages id="messages" showDetail="true" autoUpdate="true" />




				<h:panelGrid columns="2" cellpadding="5" width="100%"
					columnClasses="formLabel">
					<p:outputLabel for="emailInput" value="E-mail" />
					<p:inputText id="emailInput" value="#{registration.user.email}"
						required="true" size="40" style="width:300px;">
						<f:validator validatorId="uniqueEmailValidator" />
					</p:inputText>

					<p:outputLabel for="imieInput" value="Imię" />
					<p:inputText id="imieInput" value="#{registration.user.name}"
						required="true" size="40" style="width:300px;" />

					<p:outputLabel for="nazwiskoInput" value="Nazwisko" />
					<p:inputText id="nazwiskoInput" style="width:300px;"
						value="#{registration.user.surname}" required="false" size="40" />

					<p:outputLabel for="plecInput" value="Płeć" />
					<p:selectOneRadio id="plecInput" value="#{registration.user.sex}"
						style="width:200px" required="true">
						<f:selectItem itemLabel="kobieta" itemValue="K" />
						<f:selectItem itemLabel="mężczyzna" itemValue="M" />
					</p:selectOneRadio>


					<p:outputLabel for="wyznanieInput" value="Wyznanie" />
					<p:inputText id="wyznanieInput" style="width:300px;"
						value="#{registration.user.religion}" required="false" size="40" />

					<p:outputLabel for="wspolnotaInput" value="Wspólnota" />
					<p:inputText id="wspolnotaInput" style="width:300px;"
						value="#{registration.user.community}" required="false" size="40" />

					<p:outputLabel for="dataUrInput" value="Data urodzenia" />
					<p:calendar id="dataUrInput" value="#{registration.user.birthDate}"
						pattern="dd-MM-yyyy" mask="true" required="true" style="width:300px;"/>

					<p:outputLabel for="adresInput" value="Adres" />
					<p:inputTextarea id="adresInput" style="width:300px;"
						value="#{registration.user.address}" required="false" size="40"
						rows="2" />

					<p:outputLabel for="kodInput" value="Kod pocztowy" />
					<p:inputText id="kodInput" value="#{registration.user.code}"
						required="false" size="10" />

					<p:outputLabel for="miejscowoscInput" value="Miejscowość" />
					<p:inputText id="miejscowoscInput" style="width:300px;"
						value="#{registration.user.place}" required="false" size="40" />


					<p:outputLabel for="wojecodztwoInput" value="Województwo" />
					<p:selectOneMenu id="wojecodztwoInput" style="width:300px;" required="true"
						value="#{registration.user.province}">
						<f:selectItem itemLabel="---wybór---" itemValue="" />
						<f:selectItem itemLabel="dolnośląskie" itemValue="dolnośląskie" />
						<f:selectItem itemLabel="kujawsko-pomorskie"
							itemValue="kujawsko-pomorskie" />
						<f:selectItem itemLabel="lubelskie" itemValue="lubelskie" />
						<f:selectItem itemLabel="lubuskie" itemValue="lubuskie" />
						<f:selectItem itemLabel="łódzkie" itemValue="łódzkie" />
						<f:selectItem itemLabel="małopolskie" itemValue="małopolskie" />
						<f:selectItem itemLabel="mazowieckie" itemValue="mazowieckie" />
						<f:selectItem itemLabel="opolskie" itemValue="opolskie" />
						<f:selectItem itemLabel="podkarpackie" itemValue="podkarpackie" />
						<f:selectItem itemLabel="podlaskie" itemValue="podlaskie" />
						<f:selectItem itemLabel="pomorskie" itemValue="pomorskie" />
						<f:selectItem itemLabel="śląskie" itemValue="śląskie" />
						<f:selectItem itemLabel="świętokrzyskie"
							itemValue="świętokrzyskie" />
						<f:selectItem itemLabel="warmińsko-mazurskie"
							itemValue="warmińsko-mazurskie" />
						<f:selectItem itemLabel="wielkopolskie" itemValue="wielkopolskie" />
						<f:selectItem itemLabel="zachodniopomorskie"
							itemValue="zachodniopomorskie" />
					</p:selectOneMenu>

					<p:outputLabel for="krajInput" value="Kraj" />
					<p:inputText id="krajInput" value="#{registration.user.country}"
						required="false" size="40" style="width:300px;" />

					<p:outputLabel for="haslo" value="Hasło" />
					<p:password id="haslo" value="#{registration.user.password}"
						style="width:300px;" match="haslo2" feedback="true" size="40"
						promptLabel="Moc hasła" required="true" weakLabel="Słabe"
						goodLabel="Średnie" strongLabel="Silne" />

					<p:outputLabel for="haslo2" value="Powtórz hasło" />
					<p:password id="haslo2" value="#{registration.user.password}"
						style="width:300px;" feedback="true" size="40"
						promptLabel="Moc hasła" required="true" weakLabel="Słabe"
						goodLabel="Średnie" strongLabel="Silne" />
					<!--  REGULAMIN  -->
					<h:panelGroup>
						<p:selectBooleanCheckbox value="#{registration.regulations}"
							required="true" />
						<h:outputText value=" Oświadczam, że zapoznałem się z " />
						<h:commandLink value="regulaminem">
							<rich:componentControl target="popup" operation="show" />
						</h:commandLink>
					</h:panelGroup>

					<div class="buttonPanel">
						<p:commandButton value="Zapisz" action="#{registration.save()}"
							render="@form" />
					</div>
				</h:panelGrid>
				<br/>

			</rich:panel>


		</h:form>

		<rich:popupPanel id="popup" modal="true" width="600" height="500"
			resizeable="true">
			<div style="overflow: scroll; width: 100%; height: 435px;">
				<ui:include src="/regulamin.xhtml" />

			</div>
			<br />


			<h:form style="text-align:center;">
				<a4j:commandButton value="Zamknij">
					<rich:componentControl target="popup" operation="hide" />

				</a4j:commandButton>
			</h:form>

		</rich:popupPanel>
	</ui:define>

</ui:composition>